{extend name="base" /}
{block name="body"}
<div class="layui-body">
    <!--tab标签-->
    <div class="layui-tab layui-tab-brief">
        <ul class="layui-tab-title">
            <li class="layui-this">预约管理</li>
            <li class=""><a href="{:url('admin/message/index2')}">评测管理</a></li>
        </ul>
        <div class="layui-tab-content">

            <form class="layui-form layui-form-pane" action="{:url('admin/message/index')}" method="get">
                <div class="layui-inline">
                    <label class="layui-form-label">手机号码</label>
                    <div class="layui-input-inline">
                        <input type="text" name="phone" value="{:input('param.phone')}" placeholder="请输入手机号码" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <button class="layui-btn">搜索</button>
                </div>
            </form>
            <hr>

            <form action="" method="post" class="ajax-form">
                <button type="button" class="layui-btn layui-btn-danger layui-btn-small ajax-action" data-action="{:url('admin/message/delete')}">删除</button>
                <div class="layui-tab-item layui-show">
                    
                    <table class="layui-table">
                        <thead>
                        <tr>
                            <th style="width: 15px;"><input type="checkbox" class="check-all"></th>
                            <th style="width: 30px;">ID</th>
                            <th>用户名称</th>
                            <th>用户手机</th>
                            <th>用户学历</th>
                            <th>用户职业</th>
                            <th>想去的国家</th>
                            <th>填写时间</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        {if condition="$data"}
                        <tbody>
                        {foreach name="data" item="v"}
                        <tr>
                            <td><input type="checkbox" name="ids[]" value="{$v.id}"></td>
                            <td>{$v.id}</td>
                            <td>{$v.name}</td>
                            <td>{$v.phone}</td>
                            <td>{$v.record}</td>
                            <td>{$v.professional}</td>
                            <td>{$v.immigrant}</td>
                            <td>{$v.addtime|date='Y-m-d H:i:s',###}</td>
                            <td class="set" style="width:70px;">
                                <a href="javascript:;" data-url="{:url('admin/message/delete',['id'=>$v['id']])}" class="layui-btn layui-btn-danger layui-btn-mini">删除</a>
                            </td>
                        </tr>
                        {/foreach}
                        {else/}
                        <tr>
                            <td colspan="15" style="text-align: center;"><i class="fa fa-exclamation-circle"></i>没有数据</td>
                        </tr>
                        {/if}
                        </tbody>
                    </table>
                    <!--分页-->
                    {$page}
                </div>
            </form>
        </div>
    </div>
</div>
{/block}
{block name="script"}
<script>
$(function(){
    $('.set a').on('click',function(){
        var url = $(this).data('url');
        layer.open({
            shade: false,
            content: '确定要删除吗？',
            btn: ['确定', '取消'],
            yes: function (index) {
                $.getJSON(url,function(data){
                    layer.msg(data.msg);
                    if(data.code)
                        setTimeout(function(){window.location.reload()},2000);
                })
                layer.close(index);
            }
        });
    })
})
</script>
{/block}